package com.wwg.util.excel;

import com.wwg.util.WWGAssertUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @description 文件路径配置
 * @systemName 融资平台
 * @author yyh
 * @date 2019年8月29日 下午4:19:10
 * @version V1.0
 */
@Component("excelConfig")
public class ExcelConfigImpl implements ExcelConfig{
	private static final String EXCEL_ZIP_FILEPATH = "${excel.zip.filePath}";
	private static final String EXCEL_ZIP_MAXROW = "${excel.zip.maxRow}";
	private static final String EXCEL_ZIP_PAGESIZE = "${excel.zip.pageSize}";
	private static final String EXCEL_ZIP_TIMEOUT = "${excel.zip.timeOut}";
	@Value("${excel.zip.filePath:}")
	private String filePath ;
	@Value("${excel.zip.maxRow:}")
	private String maxRow ;
	@Value("${excel.zip.pageSize:120000}")
	private String pageSize ;
	@Value("${excel.zip.timeOut:}")
	private String timeOut ;

	public String getFilePath() {
		if(!WWGAssertUtil.equals(EXCEL_ZIP_FILEPATH, filePath)){
			return filePath;
		}
		return null;
	}


	public int getMaxRow() {
		if(!WWGAssertUtil.isEmpty(maxRow) && !WWGAssertUtil.equals(EXCEL_ZIP_MAXROW, maxRow)){
			return Integer.parseInt(maxRow);
		}
		return 0;
	}
	
	@Override
	public int getPageSize() {
		if (!WWGAssertUtil.isEmpty(pageSize) && !WWGAssertUtil.equals(EXCEL_ZIP_PAGESIZE, pageSize)) {
			return Integer.parseInt(pageSize);
		}
		return 0;
	}

	@Override
	public int getTimeOut() {
		if (!WWGAssertUtil.isEmpty(timeOut) && !WWGAssertUtil.equals(EXCEL_ZIP_TIMEOUT, timeOut)) {
			return Integer.parseInt(timeOut);
		}
		return 0;
	}

}
